<?php include "include/function_library.php"; ?>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>

<?php include "html/header.html"; ?>

</head>
<body class="tcuk home">

	<div id="wp">
	
		<?php  include "html/menu.html"; ?>
		
		<!-- CONTENT STARTS-->
		<div id="ct"> 	
			
			<?php 
			if(post("transportation_submit")) {
				$transportation_source 		= post("transportation_source");
				$transportation_destination = post("transportation_destination");
				$transportation_date 		= post("transportation_date");
				$transportation_capacity 	= post("transportation_capacity");
				$transportation_type 		= post("transportation_type");
				$transportation_price 		= post("transportation_price");
				$transportation_description	= post("transportation_description");
				
				$query = "INSERT INTO transportation (source, destination, date, price, type, description, capacity) 
						  VALUES ('$transportation_source', '$transportation_destination', '$transportation_date', '$transportation_price', '$transportation_type', '$transportation_description', '$transportation_capacity')";
				$result = sql_query($query);
				
				if($result) {
					echo "<div class='alert success'>Transportation Saved Successfully! You can <a href='transportation_list.php'>take a look </a>at transportation list.</div>";
				} else {
					echo "<div class='alert error'>Error! Could Not Save! There is(are) error(s) in the form!</div>";
				}
			}
			?>
			<br/><h2>Add Transportation</h2>
			<form action="<?php echo curPageURL(); ?>" method="post">
			<ul id="signup_form" style="width: 50%; margin-left: auto; margin-right: auto; margin-top: 30px; list-style: none;">
				<li style="border: none;">
					<label>Source </label>
					<input type="text" id="transportation_source" name="transportation_source" value="" placeholder="Transportation source.." style="width: 250px;"/>
				</li>
				<li>
					<label>Destination </label>
					<input type="text" id="transportation_destination" name="transportation_destination" value="" placeholder="Transportation destination.." style="width: 250px;"/>
				</li>
				<li>
					<label>Date </label>
					<input type="date" id="transportation_date" name="transportation_date" value="" placeholder="Transportation date.." style="width: 250px;"/>
				</li>
				<li>
					<label>Capacity </label>
					<input type="number" id="transportation_capacity" name="transportation_capacity" value="" placeholder="Transportation capacity.." style="width: 250px;"/>
				</li>
				<li>
					<label>Type </label>
					<select id="transportation_type" name="transportation_type">
						<option value="Bus">Bus</option>
						<option value="Plane">Plane</option>
						<option value="Ship">Ship</option>
						<option value="Train">Train</option>
					</select>
				</li>
				<li>
					<label>Price</label>
					<input type="number" id="transportation_price" name="transportation_price" value="" placeholder="Transportation Price.." style="width: 120px;"/>
				</li>
				<li>
					<label>Description </label>
					<textarea rows="10" id="transportation_description" name="transportation_description" placeholder="Transportation Description.." style="width: 250px;"></textarea>
				</li>
				<li>
					<input type="submit" id="transportation_submit" name="transportation_submit" value="Save" style="width: 90px; height:30px; margin-left: 80px;"/>
				</li>
			</ul>
			</form>
		
		</div> 	
		<!-- CONTENT ENDS-->		
		
		<?php include "html/footer.html"; ?>
		
	</div>
	
</body>
</html>